<title>密码修改</title>
<#include "/common/import.ftl" >
<script type="text/javascript" src="${ctx }/js/jquery-md5-min.js"></script>
<script>
    function modPwd() {
        var oldPass = $('#oldPass').val();
        var newPass = $('#newPass').val();
        var newPass2 = $('#newPass2').val();
        if (oldPass.length < 1) {
            $.messager.alert('提示', '请输入旧密码', 'error');
            return;
        }

        if (newPass.length < 1) {
            $.messager.alert('提示', '请输入新密码', 'error');
            return;
        }
        if (newPass.indexOf(" ") > -1) {
            $.messager.alert('提示', '新密码不能输入空格，请重新输入', 'error');
            return;
        }
        if (newPass != newPass2) {
            $.messager.alert('提示', '新密码两次输入不一致，请重新输入', 'error');
            return;
        }


        $.ajax({
            type: "post",
            url: "${ctx}/uct/user/user!update-pwd.action?oldPass="
            + oldPass.md5() + "&newPass=" + newPass.md5() + "&newPass2=" + newPass2.md5(),
            beforeSend: function (XMLHttpRequest) {
                //ShowLoading();
            },
            success: function (data, textStatus) {
                var result = jQuery.parseJSON(data);
                if (result.flag == 'T') {
                    $.messager.alert('结果', '操作成功', 'info', function () {
                        parent.closePasWin();
                    });
                } else {
                    $.messager.alert('结果', result.msg, 'error');
                }

            },
            complete: function (XMLHttpRequest, textStatus) {
                //HideLoading();
            },
            error: function () {
                //请求出错处理
            }
        });

    }

    $(function () {
        $('#oldPass').focus();

    });
</script>
</head>
<body>
<div id="tip">
    <table class="datagrid-body">
        <tr>
            <td class="datagrid-header">用户账号<font color=red>*</font></td>
            <td>
                <input name="cateEname" id="cateEname" disabled="disabled"
                       value="${loginUser.userEname!''}"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">用户姓名</td>
            <td>
                <input id="cateRemark" name="cateRemark" disabled="disabled"
                       value="${loginUser.userCname!''}"
                />
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">旧密码</td>
            <td align="left">
                <input id="oldPass" name="oldPass" type="password" value=""
                       class="easyui-validatebox"
                       data-options="required:true,validType:'length[1,30]'" size="30"
                       missingMessage="旧密码"
                       invalidMessage="应为1~30个字"/>
            </td>

        </tr>
        <tr>
            <td class="datagrid-header">新密码</td>
            <td align="left">
                <input id="newPass" name="newPass" type="password" value=""
                       class="easyui-validatebox"
                       data-options="required:true,validType:'length[0,30]'" size="30"
                       missingMessage="新密码"
                       invalidMessage="不能超过30个字"/>
            </td>

        </tr>
        <tr>
            <td class="datagrid-header">确认新密码</td>
            <td align="left">
                <input id="newPass2" name="newPass2" type="password" value=""
                       class="easyui-validatebox"
                       data-options="required:true,validType:'length[0,30]'" size="30"
                       missingMessage="新密码"
                       invalidMessage="不能超过30个字"/>
            </td>

        </tr>

        <tr>
            <td class="datagrid-header"></td>
            <td>
                <a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save"
                   onclick="modPwd();">保存</a>
            </td>
        </tr>

    </table>

</div>
</body>
</html>
